// 从路由模块上拿到创建路由方法，和路由模式方法
import { createRouter, createWebHashHistory } from 'vue-router'
// 提前直接引入路由匹配的模块
import Home from '../views/Home.vue'
// 创建路由对象
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      alias: "/home",
      component: Home
    },
    // {
    //   path:"/home",
    //   redirect: "/"
    // },
    {
      path: '/cart',
      name: 'cart',
      component: () => import('../views/cart.vue')
    },
    {
      path: '/expose',
      name: 'expose',
      component: () => import('../views/expose.vue')
    },
    {
      path: '/goods',
      name: 'goods',
      component: () => import('../views/goods.vue'),
      children: [{
        path: "detail",
        name: "detail",
        component: () => import('../views/detail.vue')
      }]
    }
  ]
})

export default router
